
package org.codebase.hadoop.zookeeper.base;

import java.io.IOException;

import org.apache.zookeeper.ZooKeeper;

/**
 * 节点更新修改类
 **************************************************
 * ClassName:DataUpdater

 * @author:xiaozhichao
 * @date:2018年8月15日
 **************************************************
 */
public class DataUpdater {

	private String hostPort;
	private ZooKeeper zk;
	private Handler handler;

	public DataUpdater(String hostPort,Handler handler) {
		this.hostPort = hostPort;
		this.handler = handler;
		try {
			this.zk = new ZooKeeper(this.hostPort, 2000, null);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void run() {
		this.handler.handle(this.zk, null);
	}

}
